{include file="header.html"}
<script type="text/javascript">
    $(function () {
        $('#integral_goods_form').validate({
            errorPlacement: function (error, element) {
                $(element).next('.field_notice').hide();
                $(element).after(error);
            },
            success: function (label) {
                label.addClass('right').text('OK!');
            },
            onkeyup: false,
            rules: {
                type: {
                    required: true,
                    number: true
                },
                status: {
                    required: true,
                    number: true
                },
                image: {
                    accept: 'gif|png|jpe?g'
                },

            },
            messages: {
                type: {
                    required: '{$lang.goods_empty}',
                    remote: '{$lang.name_exist}'
                },
                status: {
                    required: '{$lang.empty}',
                    number: '{$lang.need_number}'
                },
                goods_logo: {
                    accept: '{$lang.limit_img}'
                },
            }
        });
    });
</script>
<div id="rightTop">
    <p>活动弹窗管理</p>
    <ul class="subnav">
        <li><a class="btn1" href="index.php?app=popup">{$lang.manage}</a></li>
        {if $integral_goods.goods_id}
        <li><a class="btn1" href="index.php?app=popup&amp;act=add">{$lang.add}</a></li>
        {else}
        <li><span>{$lang.add}</span></li>
        {/if}
    </ul>
</div>

<div class="info">
    <form method="post" enctype="multipart/form-data" id="integral_goods_form">
        <table class="infoTable">
            <tr>
                <th class="paddingT15">
                    备注:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="remark" type="text" name="remark" value="{$info.remark|escape}" /> <label class="field_notice">备注</label>
                </td>
            </tr>


            <tr>
                <th class="paddingT15">
                    显示位置:
                </th>
                <td class="paddingT15 wordSpacing5">
                    <select class="querySelect" name="keyword">
                        <option value="">请选择显示位置</option>
                        {html_options options=$keywordList selected=$query.keyword}
                    </select>
                </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    类型:
                </th>
                <td class="paddingT15 wordSpacing5">
                    <select class="querySelect" name="type" id="type">
                        <option value="">请选择类型</option>
                        {html_options options=$typeList selected=$query.type}
                    </select>
                </td>
            </tr>
            <tr>
                <th class="paddingT15">对应内容:</th>
                <td class="paddingT15 wordSpacing5">
                    <select class="querySelect" name="popup_id" id="popid">
                        <option value="0">请选择内容</option>
                        <!--{if $info.popup_id}-->
                            <!--{foreach from=$list item=v}-->
                                <option value="{$v.popup_id}" <!--{if $v.popup_id eq $info.popup_id}-->selected<!--{/if}-->>{$v.title}</option>
                            <!--{/foreach}-->
                        <!--{/if}-->
                    </select>
                </td>
            </tr>

            <tr>
                <th class="paddingT15">
                    图片:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableFile2" id="image" type="file" name="image" />
                </td>
            </tr>
            {if $info.image}
            <tr>
                <th class="paddingT15">
                </th>
                <td class="paddingT15 wordSpacing5">
                    <img src="{$info.image}" class="makesmall" max_width="120" max_height="90" />
                </td>
            </tr>
            {/if}
            <tr>
                <th class="paddingT15">状态</th>
                <td class="paddingT15 wordSpacing5">
                    {html_radios options=$yes_or_no checked=$info.status name=status}</td>
                </td>
            </tr>

            <tr>
                <th></th>
                <td class="ptb20">
                    <input class="formbtn" type="submit" name="Submit" value="{$lang.submit}" />
                    <input class="formbtn" type="reset" name="Submit2" value="{$lang.reset}" />
                </td>
            </tr>
        </table>
    </form>
</div>
{include file="footer.html"}
<script src="//cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="//cdn.bootcss.com/layer/2.3/layer.js"></script>
<script>
    $("#type").change(function(){
        var typeValue = $(this).val();
        if(typeValue){
            //请求banner或theme列表
            var url = "index.php?app=popup&act=getList";
            $.post(url,{
                typeValue:typeValue
            },function(data){
                var res = JSON.parse(data);
                if(res.code == -1){
                    layer.msg('请求数据暂无！');
                    return false;
                }
                var str = '<option value="">请选择类型</option>';
                $.each(res.data,function(index,item){
                    str += "<option value='"+item.popup_id+"'>"+item.title+"</option>";
                })
                $("#popid").html(str);
            })
        }
    })
</script>

